﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using ZoneLineNew.Enums;
using ZoneLineNew.Models.Dto;
using ZoneLineNew.Models.Entity;
using ZoneLineNew.Models.Entity.BaseInfo;

namespace ZoneLineNew.Common {

    /// <summary>
    /// 缓存类
    /// </summary>
    public class Cache {

        private static List<string> _workStationValidates = new List<string>();
        /// <summary>
        /// 工位验证集合
        /// </summary>
        public static List<string> WorkStationValidationList {
            get { return _workStationValidates; }
            set { _workStationValidates = value; OnStaticPropertyChanged(); }
        }


        private static bool _isHOpStation;
        /// <summary>
        /// 后减
        /// </summary>
        public static bool IsHopStaion {
            get { return _isHOpStation; }
            set { _isHOpStation = value; OnStaticPropertyChanged(); }
        }

        private static bool _isQOpStation;
        /// <summary>
        /// 前减
        /// </summary>
        public static bool IsQopStaion {
            get { return _isQOpStation; }
            set { _isQOpStation = value; OnStaticPropertyChanged(); }
        }

        private static bool _isXWOpStation;
        /// <summary>
        /// 线外
        /// </summary>
        public static bool IsXWopStaion {
            get { return _isXWOpStation; }
            set { _isXWOpStation = value; OnStaticPropertyChanged(); }
        }


        private static ProductDto _curWorkProduct;
        /// <summary>
        /// 当前加工产品
        /// </summary>
        public static ProductDto CurWorkProduct {
            get { return _curWorkProduct; }
            set { _curWorkProduct = value; OnStaticPropertyChanged(); }
        }


        private static List<FormulaItem> _currentFormula = new List<FormulaItem>();
        /// <summary>
        /// 当前工位配方
        /// </summary>
        public static List<FormulaItem> CurrentFormula {
            get { return _currentFormula; }
            set { _currentFormula = value; OnStaticPropertyChanged(); }
        }


        #region 静态观察者

        // 定义静态 PropertyChanged 事件（供 WPF 绑定系统监听）
        public static event PropertyChangedEventHandler StaticPropertyChanged;

        // 触发静态属性变化的方法
        private static void OnStaticPropertyChanged([CallerMemberName] string propertyName = null) {
            StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));
        }

        #endregion 静态观察者
    }
}
